Code
knitr::kable(head(penguins))Hands on
Ellis Franklin
Elise Billoir
February 6, 2025
Before this exercise:
penguins-template.qmd filethree-penguins.png imageFile > New Project, then Browse to the downloaded zip file and Create.install.packages("palmerpenguins") into the Console and run it.Open the penguins-template.qmd file in RStudio
Add a Level 2 header titled “Data Overview” after the existing content in the file
Copy and paste the following text into the file:
Modify the text so that the final rendering looks like this, with the value 344 inserted using inline code:
The penguins
penguinscontains 344 observations of penguins. It includes several qualitative variables, including the following:
- Sex of the penguins
- Island where they are found
- Species to which they belong
The represented species are : Chinstrap, Gentoo et Adélie.
Add the image three-penguins.png to your document, then add a caption for this image.
penguins dataframe using the knitr::kable() function.ggplot2) to explore the relationship between the body mass of penguins and the length of their flippers, as well as the differences between species.For those not familiar with R, unfold the following, copy and paste into the document and render:
g <- ggplot(penguins, aes(x = flipper_length_mm,
y = body_mass_g)) +
geom_point(aes(color = species, shape = species),
size = 2,
alpha = 0.7) +
scale_color_manual(values = c("darkorange","purple","cyan4")) +
labs(x = "Flipper length (mm)",
y = "Body mass (g)",
color = "Penguin species",
shape = "Penguin species") +
theme_minimal()
gAdd the following options to the code chunk, one by one. Generate the document after each modification and observe the changes:
echo: falsewarning: falseJust below the figure, provide a description of the relationship between the two variables, both overall and for each species.
Modify the size of the figure using the following options, one by one. Re-render the document after each modification and describe how the figure changes:
fig-width: 10fig-height: 3out-width: "100%"out-width: "20%"Add a label to the figure with the prefix fig-.
Add a caption to the figure using the fig-cap chunk option. Re-render one last time.
Well done! You’ve just created your first Quarto report 🎉 !